<template>
  <van-nav-bar
      title="设置"
      style="width: 400px"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
  />
  <div class="content">
  <van-cell is-link title="个人资料" @click="gotoPersonalDataPage" />
  <van-cell is-link title="账号与安全" @click="gotoAccountSecurityPage" />
  <van-cell is-link title="我的收货地址" @click="gotoReceivingAddressPage" />
  <van-cell is-link title="消息与提醒" @click="gotoMessageReminderPage" />
  <van-cell is-link title="播放与下载" @click="gotoPlayDownloadPage" />
  <van-cell is-link title="清除缓存" @click="ClearCache" />
  <van-cell is-link title="关于我们" @click="gotoAboutUsPage" />
  </div>
  <van-button  type="primary" block @click="logout">退出登录</van-button>
</template>
<script setup>
import {ref} from 'vue'
import {useRouter} from "vue-router";
import axios from "axios";
const router=useRouter();
const onClickLeft = () => {
  router.push("/my");
  // 返回按钮逻辑
};
const gotoPersonalDataPage=()=>{
  router.push("/personalData");
}
const gotoAccountSecurityPage=()=>{
  router.push("/accountSecurity");
}
const gotoReceivingAddressPage=()=>{
  router.push("/addressList");
}
const gotoMessageReminderPage=()=>{
  router.push("/messageReminder");
}
const gotoPlayDownloadPage=()=>{
  router.push("/playDownload");
}
const gotoAboutUsPage=()=>{
  router.push("/aboutUs");
}
const ClearCache=()=>{
 /* axios.get("http://localhost:8081/api/user/clearCache").then(res=>{
    if(res.data.code==0){
      alert("清除缓存成功");
    }
  })*/
  alert("清除缓存成功");
}
const logout=()=>{
  axios.get("http://localhost:8081/api/user/logout").then(res=>{
    if(res.data.code==0){
      router.push("/login");
    }
  })
}
</script>
<style scoped>
.content{
 left: 10px;
  padding-left: 20px;
}

</style>